package com.hnhegui.backend.platform.controller.order;

import com.hnhegui.backend.entity.Result;
import com.hnhegui.backend.platform.service.order.RestFulfillmentService;
import com.hnhegui.backend.platform.vo.order.request.FulfillmentRequestVO;
import com.hnhegui.backend.platform.vo.order.response.FulfillmentResponseVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 履约Controller
 */
@Validated
@RestController
@RequestMapping("/rest/api/fulfillments")
public class RestFulfillmentController {

    @Autowired
    private RestFulfillmentService fulfillmentService;

    /**
     * 订单履约
     */
    @PostMapping
    public Result<FulfillmentResponseVO> processFulfillment(@Validated @RequestBody FulfillmentRequestVO request) {
        FulfillmentResponseVO response = fulfillmentService.processFulfillment(request);
        return Result.success(response);
    }
}
